<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ include file="/commons/taglibs.jsp" %>
<script type="text/javascript" src="${web_domain}/resources/plugins/feijin.page.js"></script>
<style>
    .layui-input {
        display: inline;
    }
</style>
<c:set var="totalPages" value="${page.totalPages }"></c:set>
<form id="pageForm" method="get">
    <div class="layui-box layui-laypage layui-laypage-default" id="layui-laypage-10">

        <div id="paged" class="page">
            <span class="layui-laypage-count">共 ${page.totalCount} 条</span>
            <div class="layui-box layui-laypage layui-laypage-default">
                <c:choose>
                    <c:when test="${page.totalCount > 0 }">
                        <a class="laypage_first" href="javascript:feijinPage.jumpPage(1)">首页</a>
                        <a class="layui-laypage-prev" href="javascript:feijinPage.jumpPage(${((page.pageNo)-1)>0?(page.pageNo)-1:(page.pageNo)})">上一页</a>
                        <c:choose>
                            <c:when test="${page.pageNo == 1}">
                                <span class="layui-laypage-curr"><em class="layui-laypage-em"></em><em>1</em></span>
                            </c:when>
                            <c:otherwise>
                                <a href="javascript:feijinPage.jumpPage(1)">1</a>
                            </c:otherwise>
                        </c:choose>
                        <c:choose>
                            <c:when test="${totalPages>0}">
                                <c:choose>
                                    <c:when test="${page.pageNo<10}">
                                        <c:forEach var="i" begin="2" end="${page.pageNo}">
                                            <c:choose>
                                                <c:when test="${page.pageNo eq i }">
                                                    <span class="layui-laypage-curr"><em class="layui-laypage-em"></em><em>${i}</em></span>
                                                </c:when>
                                                <c:otherwise>
                                                    <a href="javascript:feijinPage.jumpPage(${i})">${i}</a>
                                                </c:otherwise>
                                            </c:choose>
                                        </c:forEach>
                                    </c:when>
                                    <c:otherwise>
                                        <c:forEach var="i" begin="${page.pageNo-3}" end="${page.pageNo}">
                                            <c:choose>
                                                <c:when test="${page.pageNo eq i }">
                                                    <span class="layui-laypage-curr"><em class="layui-laypage-em"></em><em>${i}</em></span>
                                                </c:when>
                                                <c:otherwise>
                                                    <a href="javascript:feijinPage.jumpPage(${i})">${i}</a>
                                                </c:otherwise>
                                            </c:choose>
                                        </c:forEach>
                                    </c:otherwise>
                                </c:choose>
                                <c:choose>
                                    <c:when test="${page.pageNo>=totalPages-3  || totalPages-3<=0}">
                                        <c:forEach var="i" begin="${page.pageNo+1}" end="${totalPages}">
                                            <a href="javascript:feijinPage.jumpPage(${i})">${i}</a>
                                            <c:choose>
                                                <c:when test="${page.pageNo eq i }">
                                                    <span class="layui-laypage-curr"><em class="layui-laypage-em"></em><em>${i}</em></span>
                                                </c:when>
                                            </c:choose>
                                        </c:forEach>
                                    </c:when>
                                    <c:otherwise>
                                        <c:forEach var="i" begin="${page.nextPage}" end="${page.pageNo+3}">
                                            <c:choose>
                                                <c:when test="${page.pageNo eq i }">
                                                    <span class="layui-laypage-curr"><em class="layui-laypage-em"></em><em>${i}</em></span>
                                                </c:when>
                                                <c:otherwise>
                                                    <a href="javascript:feijinPage.jumpPage(${i})">${i}</a>
                                                </c:otherwise>
                                            </c:choose>
                                        </c:forEach>
                                        <a href="javascript:feijinPage.jumpPage(${totalPages})">${totalPages}</a>
                                    </c:otherwise>
                                </c:choose>
                                <a class="layui-laypage-next" href="javascript:feijinPage.jumpPage(${(page.nextPage) < totalPages?page.nextPage: totalPages})">下一页</a>
                                <a class="layui-laypage-last" href="javascript:feijinPage.jumpPage(${page.totalPages })">末页</a>
                            </c:when>
                        </c:choose>
                    </c:when>
                </c:choose>


                <span style="padding-right: 0;display: none;" class="layui-laypage-count">
                    每页显示<select name="pageSize" id="pageSize" lay-ignore style="width: 50px;margin-left: 15px; border: 1px solid #e2e2e2;display:inline-block;">
                        <c:choose>
                            <c:when test="${page.pageSize == 10}">
                                <option selected="selected" value="10">10</option>
                            </c:when>
                            <c:otherwise>
                                <option value="10">10</option>
                            </c:otherwise>
                        </c:choose>

                        <c:choose>
                            <c:when test="${page.pageSize == 20}">
                                <option selected="selected" value="20">20</option>
                            </c:when>
                            <c:otherwise>
                                <option value="20">20</option>
                            </c:otherwise>
                        </c:choose>
                        <c:choose>
                            <c:when test="${page.pageSize == 30}">
                                <option selected="selected" value="30">30</option>
                            </c:when>
                            <c:otherwise>
                                <option value="30">30</option>
                            </c:otherwise>
                        </c:choose>
                    </select>
                </span>

                <span class="layui-laypage-count">跳到
                <input type="text" id="page_no" class="layui-input page_input" style="height: 28px;" onkeyup="this.value=value.replace(/[^\d]/g,'') " onafterpaste="this.value=value.replace(/[^\d]/g,'') ">页</span>
                <a href="javascript:if($('#page_no').val() >0 && $('#page_no').val() <=${page.totalPages }){feijinPage.jumpPage($('#page_no').val())}else{$('#page_no').val('')}">确定</a>
                </span>

            </div>
        </div>
    </div>
</form>
<script>
    $(function () {
        $("#pageSize").change(function () {
            feijinPage.jumpPage("${page.pageNo}");
        });
    });
</script>